/* ====================================== 模块子路由配置  ====================================== */
import React from 'react'
import { Route, Switch, withRouter } from 'react-router-dom'
// ===================================================================== 异步加载
import Import from '@com/lazy/lazy-router'
// const { $fn } = window
// const baseRoot = $fn.getRoot().root
// ===================================================================== 同步路由
const Index = ({data, match}) => {
	return (
		<Switch>
			{
				data.map((v,i)=> <Route key={i} path={v.path} component={ Import(v.component)  } exact />)
			}
			<Route path={match.url+'/folder'} component={ Import('workbench/document-manage/folder') } exact/>
			<Route path={match.url + '/file-detail'} component={Import('workbench/document-manage/component/file-detail')} exact/>
			{/* 404 */}
			{data.length && <Route component={ Import('404') } />}
		</Switch>
	)
}
export default withRouter(Index)